package com.wanxi;

public class TheSum {
    //需求：有这样的一个数组，元素是{68,27,95,88,171,172,996,51,210}。求出该数组中满足要求的元素和，
//       要求是：求和的元素个位和十位都不能是7，并且只能是偶数
    public static void main(String[] args) {
        int[] array = {68, 27, 95, 88, 171, 172, 177,996, 51, 210};

        int sum = 0;

        sum = getSum(array, sum);

        System.out.println(sum);

    }

    private static int getSum(int[] array, int sum) {
        for (int i = 0; i < array.length; i++) {
            int number = array[i];
            if (number % 2 == 0) {
                int ge = number % 10;
                int shi = number / 10 % 10;

                if (ge != 7 && shi != 7) {

                    sum += number;

                }

            }

        }
        return sum;
    }


}
